//
//  DiGeamKit.h
//  DiGeamKitDemo
//
//  Created by iOS on 2024/4/13.
//

#define DiGKLog(format,...)  [DiGeamKit digkLogWithFunction:__FUNCTION__ lineNumber:__LINE__ formatString:[NSString stringWithFormat:format, ##__VA_ARGS__]]
#import <Foundation/Foundation.h>
#import <DiGeamKit/DiGeamKitCofig.h>

NS_ASSUME_NONNULL_BEGIN
//SDK版本號
#define DiGeamKitSDKVersionLevel @"1"

@interface DiGeamKit : NSObject

/// 初始化對象
+ (instancetype)sharedInstance;

///sdk配置信息
@property (nonatomic, strong) DiGeamKitCofig *config;

///sdk信息
@property (nonatomic, strong) DiGeamKitInfoBean *sdkInfoBean;
/**
 *  初始化DiGeamKit
 *
 *  @param config 傳入配置的 DiGeamKitCofig
 *  @param completionHandler 完成處理回調塊。
 *                          - sdkInfoBean: SDK的詳細信息。
 *                          - error: 描述錯誤的NSError對象；如果為nil，則表示初始化成功。
 */
- (void)initWithConfig:(DiGeamKitCofig *)config responseCompletionHandler:(void (^)(DiGeamKitInfoBean *sdkInfoBean, NSError * _Nullable error))completionHandler;


/**
 * 打開DiGeamKit彈窗
 *
 * @param presentableViewController 窗口顯示的視圖控制器 (可為nil)
 * @param uiEntryPointType 窗口顯示選項 默認精選窗口
 */
+ (void)showWith:(UIViewController *)presentableViewController uiEntryPointType:( DiGeamKitUIEntryPointType)uiEntryPointType;

/**
 *  隱藏DiGeamKit彈窗
 *
 */
+ (void)dismiss;

// 日誌輸出方法
+ (void)digkLogWithFunction:(const char *)function lineNumber:(int)lineNumber formatString:(NSString *)formatString;

/// 查詢APP項目橫豎狀態
/// - Parameter completionHandler: directionType (1代表橫向2代表直向)
- (void)getGameDirectionTypeWithCompletionHandler:(void (^)(int directionType , NSError * _Nullable error))completionHandler;

#pragma mark - 數據蒐集

/// 啟動app時
/// @param serverId 伺服器
/// @param roleId 角色ID
/// @param completionHandler 結果回調
- (void)gameStartWithServerId:(NSString *)serverId
                       roleId:(NSString *)roleId
            completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 建立角色
/// @param serverId 伺服器  (當建立角色type為0時可以為null)
/// @param roleId 角色ID
/// @param roleName 角色名稱
/// @param roleCreateType 建立角色type  0 = 建立角色 1 = 角色建立完成 2 = 角色首次建立  3 = 刪除角色
/// @param completionHandler 結果回調
- (void)roleCreateWithServerId:(NSString *)serverId
                        roleId:(NSString *)roleId
                      roleName:(NSString *)roleName
                roleCreateType:(int)roleCreateType
             completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 取得現金貨幣
/// @param value 金額
/// @param currency 幣別
/// @param channelType 來源  0 = Mycard 1 = Google 2 = Apple 3 = OneStore 4 = ECPay(funpoint) 5 = BluePay(BM)
/// @param channelAmount 商城幣金額
/// @param completionHandler 結果回調
- (void)getStoreCoinWithValue:(int)value
                     currency:(NSString *)currency
                  channelType:(int)channelType
                channelAmount:(int)channelAmount
            completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 玩家基本資訊
/// @param roleId 角色ID
/// @param userCp 角色戰力
/// @param vipLevel 玩家VIP等級
/// @param cashPoint 元寶或付費取得的貨幣數值
/// @param gamePoint 遊戲幣或是免費取得的貨幣遊戲貨幣數值
/// @param completionHandler 結果回調
- (void)gameUserInfoWithRoleId:(NSString *)roleId
                        userCp:(int)userCp
                      vipLevel:(int)vipLevel
                     cashPoint:(int)cashPoint
                     gamePoint:(int)gamePoint
             completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 遊戲下載path紀錄
/// @param actionStatus 下載狀態 0 = 開始下載 1 = 下載完成
/// @param packageName 安裝包名
/// @param packageVersion 版本號
/// @param completionHandler 結果回調
- (void)pathLogWithActionStatus:(int)actionStatus
                    packageName:(NSString *)packageName
                 packageVersion:(NSString *)packageVersion
              completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 使用序號或兌換碼
/// @param giftItemId 兌換序號ID
/// @param completionHandler 結果回調
- (void)gameGiftCodeWithGiftItemId:(NSString *)giftItemId
                 completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 遊戲任務
/// @param missionType 任務分類 (0 = 新手任務  1 = 一般任務  2 = 每日任務)
/// @param missionId 任務編號
/// @param missionStatus 任務狀態 (0 = 接受任務 1 = 完成任務)
/// @param completionHandler 結果回調
- (void)gameMissionWithMissionType:(int)missionType
                         missionId:(NSString *)missionId
                     missionStatus:(int)missionStatus
                 completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 等級提升
/// @param levelType 分類 (預設帶0)
/// @param levelAmount 提升數值
/// @param levelBefore 提升前等級
/// @param levelAfter 提升後等級
/// @param completionHandler 結果回調
- (void)getLevelWithLevelType:(int)levelType
                  levelAmount:(int)levelAmount
                  levelBefore:(int)levelBefore
                   levelAfter:(int)levelAfter
            completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 獲取免費貨幣
/// @param channelType 來源 0 = MyCard 1 = Google 2 = Apple 3 = Game Gift 4 = 道具買賣 5 = 玩家交易 6 = Other
/// @param channelAmount 商城幣金額
/// @param completionHandler 結果回調
- (void)getGameCoinWithChannelType:(int)channelType
                     channelAmount:(int)channelAmount
                 completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 購買狀態紀錄
/// @param purchaseItemId 金流商品ID
/// @param purchaseStatus 購買狀態 0 = 點擊購買  1 = 完成購買  2 = 取消購買
/// @param completionHandler 結果回調
- (void)purchaseActionWithPurchaseItemId:(NSString *)purchaseItemId
                          purchaseStatus:(int)purchaseStatus
                       completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 發送聊天訊息
/// - Parameters:
///   - uidSender: 發訊息者UID
///   - uidReceiver: 接收者UID
///   - content: 訊息內容
///   - completionHandler: 結果回調
- (void)chatLogWithUidSender:(NSString *)uidSender
                 uidReceiver:(NSString *)uidReceiver
                     content:(NSString *)content
           completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 提升技能
/// @param skillId 技能編號
/// @param skillLevel 技能等級
/// @param completionHandler 結果回調
- (void)skillUpWithSkillId:(NSString *)skillId
                skillLevel:(int)skillLevel
         completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 建立/加入/離開 隊伍
/// @param actionStatus 執行動作 (0 = 建立隊伍 1 = 加入隊伍 2 = 離開隊伍)
/// @param teamId 隊伍ID
/// @param completionHandler 結果回調
- (void)teamRecordWithActionStatus:(int)actionStatus
                            teamId:(NSString *)teamId
                 completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 打開遊戲內置的活動頁
/// @param activityId 活動編號
/// @param completionHandler 結果回調
- (void)enterActivityWithActivityId:(NSString *)activityId
                  completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 關卡開始與結束
/// @param actionStatus 執行動作 (0 = 開始關卡 1 = 結束關卡)
/// @param stageId 關卡編號
/// @param stageResult 關卡結果 (當ACTION_STATUS =0開始關卡時帶0  1 = 完成關卡並獲取獎勵  2 = 手動退出 3 = 關卡失敗)
/// @param completionHandler 結果回調
- (void)stageLogWithActionStatus:(int)actionStatus
                         stageId:(NSString *)stageId
                     stageResult:(int)stageResult
               completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 掃蕩關卡
/// @param stageId 關卡編號
/// @param passNum 掃蕩的次數 若無請代入0
/// @param completionHandler 結果回調
- (void)stageQuickPassWithStageId:(NSString *)stageId
                          passNum:(int)passNum
                completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 領取禮包
/// @param giftName 禮包名稱
/// @param giftId 禮包ID
/// @param giftQuantity 數量
/// @param completionHandler 結果回調
- (void)receiveGiftsWithGiftName:(NSString *)giftName
                          giftId:(NSString *)giftId
                    giftQuantity:(int)giftQuantity
               completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 獲得稱號
/// @param achievementName 稱號名稱
/// @param achievementType 稱號類別
/// @param achievementId 稱號ID
/// @param completionHandler 結果回調
- (void)unlockAchievementWithAchievementName:(NSString *)achievementName
                             achievementType:(NSString *)achievementType
                               achievementId:(NSString *)achievementId
                           completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 加入公會
/// @param groupId 公會ID
/// @param groupName 公會名稱
/// @param completionHandler 結果回調
- (void)joinGroupWithGroupId:(NSString *)groupId
                   groupName:(NSString *)groupName
           completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 建立公會
/// @param groupId 公會ID
/// @param groupName 公會名稱
/// @param completionHandler 結果回調
- (void)createGroupWithGroupId:(NSString *)groupId
                     groupName:(NSString *)groupName
             completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 活動紀錄
/// @param activityId 活動ID
/// @param activityName 活動名稱
/// @param activityClass 活動分類
/// @param actionStatus 執行動作 (0 =  開始活動  1 =  活動完成)
/// @param completionHandler 結果回調
- (void)activityLogWithActivityId:(NSString *)activityId
                     activityName:(NSString *)activityName
                    activityClass:(NSString *)activityClass
                     actionStatus:(int)actionStatus
                completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 廣告觀看
/// @param adId 廣告ID
/// @param actionStatus 執行動作 (0=點擊廣告  1=廣告觀看完成 2=廣告觀看取消)
/// @param completionHandler 結果回調
- (void)adLogWithAdId:(NSString *)adId
         actionStatus:(int)actionStatus
    completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 每日在線獎勵
/// @param inGameTime 在線時間
/// @param inGameGift 獲得第幾層獎勵
/// @param completionHandler 結果回調
- (void)inGameWithInGameTime:(int)inGameTime
                  inGameGift:(int)inGameGift
           completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 商店購買(非金流儲值購買)
/// @param shopType 商店分類 (一般商店、公會商店…)
/// @param shopItemId 商店道具ID
/// @param itemAmount 道具數量
/// @param completionHandler 結果回調
- (void)getShopItemWithShopType:(NSString *)shopType
                     shopItemId:(NSString *)shopItemId
                     itemAmount:(int)itemAmount
              completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 選擇內容（公告、活動頁）
/// @param contentType 內容類型
/// @param achievementName 活動名稱
/// @param completionHandler 結果回調
- (void)selectContentWithContentType:(NSString *)contentType
                     achievementName:(NSString *)achievementName
                   completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 每日簽到
/// @param checkAmount 簽到狀態 預設 = 1
/// @param completionHandler 結果回調
- (void)dailyCheckWithCheckAmount:(int)checkAmount
                completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 離開遊戲
/// @param completionHandler 結果回調
- (void)gameQuitWithCompletionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 返回遊戲
/// @param completionHandler 結果回調
- (void)gameResumeWithCompletionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;


/// 使用者加入好友時
/// @param fGameUid 好友的遊戲UID
/// @param character 好友角色名稱 (允許為空)
/// @param completionHandler 結果回調
- (void)joinFriendsWithFGameUid:(NSString *)fGameUid
                      character:(NSString *)character
              completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

/// 獲取道具
/// @param purchaseCoinType 分類 (0 = 免費貨幣(綁元或是綁定鑽石)  1 = 現金貨幣  2 = IAP禮包  3 = 第三方儲值)
/// @param purchaseAmount 購買數量
/// @param purchaseItemId 道具ID
/// @param itemAmount 道具數量
/// @param source 來源
/// @param completionHandler 結果回調
- (void)itemGainLogWithPurchaseCoinType:(int)purchaseCoinType
                         purchaseAmount:(int)purchaseAmount
                         purchaseItemId:(NSString *)purchaseItemId
                             itemAmount:(int)itemAmount
                                 source:(NSString *)source
                      completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;


/// 消耗及使用道具
/// @param useItemId 道具ID
/// @param useItemAmount 使用數量
/// @param completionHandler 結果回調
- (void)itemUsedLogWithUseItemId:(NSString *)useItemId
                   useItemAmount:(int)useItemAmount
               completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;



/// 觸發按鈕
/// @param buttonId 按鈕編號 (允許為空)
/// @param buttonName 按鈕名稱 (允許為空)
/// @param buttonClass 按鈕類別 (商店按鈕、公告按鈕) (允許為空)
/// @param source 來源 (背包、角色) (允許為空)
/// @param actionType 觸發動作 (取消、購買) (允許為空)
/// @param data 額外資料 (JSON格式) (允許為空)
/// @param completionHandler 結果回調
- (void)inAppClickWithButtonId:(NSString *)buttonId
                    buttonName:(NSString *)buttonName
                   buttonClass:(NSString *)buttonClass
                        source:(NSString *)source
                    actionType:(NSString *)actionType
                          data:(NSString *)data
             completionHandler:(void (^)(NSDictionary *data, NSError * _Nullable error))completionHandler;

@end




NS_ASSUME_NONNULL_END
